package com.yykj.bank.server.converter;

import com.yykj.bank.client.dto.BankInfoDTO;
import com.yykj.bank.server.model.entity.BankInfo;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class BankInfoDTOConverter {
    public static BankInfoDTO convert(BankInfo info){
        BankInfoDTO dto = new BankInfoDTO();
        BeanUtils.copyProperties(info,dto);
        return dto;
    }

    public static List<BankInfoDTO> convert(List<BankInfo> list){
        return list.stream().map(BankInfoDTOConverter::convert).collect(Collectors.toList());
    }
}
